#!/bin/sh
#desc:Delete camera
#type:local
#package:odvision

# Copyright(c) 2011 OpenDomo Services SL. Licensed under GPL v3 or later

CAMPATH="/etc/opendomo/video"

if test -z "$1"; then
	echo "#> Delete cameras"
	echo "# No camera specified"
	echo "#INFO: No camera specified"
	exit 1
fi

for file in "$@"
do
	if test -e "$CAMPATH/$file.conf"; then
		if rm -fr "$CAMPATH/$file.conf"; then
			echo "#INFO: Camera deleted [$file]"
		else
			echo "#ERR: Cannot delete"
			exit 2
		fi
	fi
done
# Once deleted, back to the main script
/usr/local/opendomo/manageCameras.sh
